/** 
 * TokenUtils.java
 * @author Lex
 * 2007-8-18 ����02:34:00
 */
package fun.parser.util;

import fun.parser.lexer.Token;
import fun.parser.lexer.TokenType;

/**
 * Utilities for operating Token
 */
public class TokenUtils {
	public static boolean isEnd(Token token) {
		return TokenType.END == token.getTokenType();
	}

	public static boolean isOperator(Token token) {
		switch (token.getTokenType()) {
		case ADD:
		case MINUS:
		case MULTIPLY:
		case DIVIDE:
		case MOD:
		case POWER:
		case ASSIGN:
		case LEFT_P:
		case RIGHT_P:
			return true;
		default:
			return false;
		}
	}

	public static boolean isNumeric(Token token) {
		switch (token.getTokenType()) {
		case BINARY:
		case OCTAL:
		case DECIMAL:
		case HEXADECIMAL:
		case REAL:
			return true;
		default:
			return false;
		}
	}

	private TokenUtils() {
	}
}
